import requests

# 构造cookie
url_cookie = 'http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=verify&r=0.27514262266800915'

res_1 = requests.get(url_cookie)  # 返回结果
print(res_1.cookies)



url = 'http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=do_login&t=0.7467805213473402'
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36",
    'Content-Type': 'text/html; charset=UTF-8'}
data = {"username": "13600001111",
        "password": "123456",
        "verify_code": "8888"}
res = requests.post(url, data, cookies=res_1.cookies)
print(res.status_code)
print(res.text)
print(res.json())
